package com.jay.tools.recycler;

import android.view.View;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;

import java.util.List;

/**
 * Created by tan on 2017/9/20 020.
 */

public abstract class MultipleRecyclerAdapter extends BaseMultiItemQuickAdapter<MultipleItemEntity, MultipleViewHolder> {

    protected OnMultiItemClick<Object> mListener;

    public MultipleRecyclerAdapter(List<MultipleItemEntity> data) {
        super(data);
        init();
    }

    /**
     * 设置不同的item布局
     */
    private void init() {
        openLoadAnimation();
        // 多次执行动画
        isFirstOnly(false);
    }

    @Override
    protected MultipleViewHolder createBaseViewHolder(View view) {
        return MultipleViewHolder.create(view);
    }

    @Override
    protected abstract void convert(MultipleViewHolder holder, MultipleItemEntity entity);

    public void setClickListener(OnMultiItemClick<Object> itemClick) {
        mListener = itemClick;
    }

    public interface OnMultiItemClick<T> {
        /**
         * @param info 数据
         * @param type 区分布局类型
         * @param tag  区分子分类点击类型
         */
        void onClick(T info, int type, int tag);
    }
}
